Fishing Seaweed & Caskets#425
Fishing Seaweed & Caskets#425Tomm0017 wants to merge 5 commits intoapollo-rsps:kotlin-experimentsfrom Tomm0017:fishing_junk
Conversation
Codecov Report
@@ Coverage Diff @@
## kotlin-experiments #425 +/- ##
========================================================
+ Coverage 23.23% 23.23% +<.01%
Complexity 811 811
========================================================
Files 643 643
Lines 11123 11132 +9
Branches 1632 1636 +4
========================================================
+ Hits 2584 2587 +3
- Misses 8251 8256 +5
- Partials 288 289 +1
Continue to review full report at Codecov.
|
| */ | ||
| SEAWEED(id = 401, level = 16, experience = 1.0), | ||
| CASKET(id = 405, level = 16, experience = 1.0) | ||
| ; |
There was a problem hiding this comment.
Move this semicolon back to the previous line.
| * A [FishingSpot] [Option] that can provide a two different types of fish. | ||
| */ | ||
| private data class Pair(override val tool: FishingTool, val primary: Fish, val secondary: Fish) : Option() { | ||
| private class Pair(override val tool: FishingTool, val primary: Fish, val secondary: Fish, vararg val junk: Fish) : Option() { |
There was a problem hiding this comment.
Why did you remove the data modifier?
There was a problem hiding this comment.
There's also no reason for junk to be variadic. This constructor isn't a user facing API.
There was a problem hiding this comment.
The data modifier was removed as you can't have variadic values in a data class. I'll fix this though, thanks!
| } | ||
|
|
||
| fun of(tool: FishingTool, primary: Fish, secondary: Fish, junk: Array<Fish>): Option { | ||
| return when { |
There was a problem hiding this comment.
Write this as if-else instead
| return valid[rand(valid.size)] | ||
| } | ||
| } | ||
| return when { |
There was a problem hiding this comment.
Should be if-else instead of when.
|
Some style issues, otherwise LGTM |
| override val level = Math.min(primary.level, secondary.level) | ||
|
|
||
| override fun sample(level: Int): Fish { | ||
| if (junk.isNotEmpty() && rand(100) < JUNK_WEIGHTING) { |
There was a problem hiding this comment.
Hmm, we need a unit test for this, but I'm not quite sure how we go about stubbing the randomness in this case (cc @Major-).
Addresses Issue #364 where fishing seaweed & caskets from big nets is requested